package com.polaris.live.adapter

import android.view.View
import com.blankj.utilcode.util.StringUtils
import com.bumptech.glide.Glide
import com.polaris.live.common.adapter.BaseBindingAdapter
import com.polaris.live.common.adapter.VBViewHolder
import com.polaris.live.constant.LiveConst
import com.polaris.live.databinding.AdapterCallGiftBinding
import com.polaris.live.resp.back_resp.GiftBean
import com.polaris.live.translation.R.string
import com.polaris.live.utils.image.ImageUtils

/**
 * CallGiftAdapter
 *
 * @author Created by 半仙 on 2023/9/14/014 19:42
 */
class CallGiftAdapter : BaseBindingAdapter<AdapterCallGiftBinding, GiftBean>() {

    override fun convert(holder: VBViewHolder<AdapterCallGiftBinding>, item: GiftBean) {
        holder.vb.apply {
            Glide.with(callGiftImg.context).load(ImageUtils.imgPath(item.pic)).into(callGiftImg)
            if (item.type == LiveConst.GiftType.FREE_GIFT) {
                callGiftFreeImg.visibility = View.VISIBLE
                callGiftText.text = StringUtils.getString(string.free)
            } else {
                callGiftFreeImg.visibility = View.GONE
                callGiftText.text = "${item.coin}"
            }
        }
    }

}